package com.itibo.models;

        import java.io.File;
        import java.io.FileNotFoundException;
        import java.io.UnsupportedEncodingException;
        import java.util.Scanner;

public class ByteDocument extends Document {
    Scanner scaner;

    public ByteDocument(byte[] bytes) throws FileNotFoundException {
        super(bytes);
        String str = null;
        try {
            str = new String(bytes, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        scaner = new Scanner(str);
    }

    public String[] readObject() {
        if (scaner.hasNext()) {
            return scaner.nextLine().split(",");
        }
        return null;
    }
    public void writeObject(String[] s1){
        String currentSong=s1[0]+","+s1[1]+","+s1[2]+","+s1[3];
        body.append(currentSong).append('\n');

    }
}
